package lib

func init() {
	Probs = append(Probs, Problem{
		Num:         58,
		Discription: "最后一个单词的长度",
		Level:       1,
		Labels: map[string]int{
			"字符串": 1,
		},
	})
}

func LengthOfLastWord(s string) int {
	count := 0
	for i := len(s) - 1; i >= 0; i-- {
		if s[i] == ' ' {
			if count == 0 {
				continue
			} else {
				break
			}
		}
		count++
	}

	return count
}
